package com.muyu.breakdown.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.breakdown.domain.SysCarFaultLog;
import com.muyu.breakdown.domain.SysCarFaultLog;
import com.muyu.breakdown.mapper.SysCarFaultLogMapper;
import com.muyu.breakdown.mapper.SysCarFaultMapper;
import com.muyu.breakdown.service.SysCarFaultLogService;
import com.muyu.breakdown.service.SysCarFaultLogService;
import com.muyu.common.core.utils.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassDescription:
 * @JdkVersion: 1.8
 * @Author: YZL
 * @Created: 2024/9/22 21:07
 */
@Service
public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper, SysCarFaultLog> implements SysCarFaultLogService {



    @Override
    public List<SysCarFaultLog> selectSysCarFaultLogList(SysCarFaultLog sysCarFaultLog) {
        LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
            wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
        }
        if (sysCarFaultLog.getStatus()!=null){
            wrapper.eq(SysCarFaultLog::getStatus,sysCarFaultLog.getStatus());
        }
        return this.list(wrapper);
    }

    /**
     * 只展示忽略的数据
     * @param sysCarFaultLog
     * @return
     */
    @Override
    public List<SysCarFaultLog> listStatusIgnore(SysCarFaultLog sysCarFaultLog) {
        LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysCarFaultLog::getStatus,3);
        if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
            wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
        }
        return this.list(wrapper);
    }

    /**
     * 只展示处理中的数据
     * @param sysCarFaultLog
     * @return
     */
    @Override
    public List<SysCarFaultLog> listStatusProcess(SysCarFaultLog sysCarFaultLog) {
        LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysCarFaultLog::getStatus,2);
        if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
            wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
        }
        return this.list(wrapper);
    }

    //只展示已解决的数据
    @Override
    public List<SysCarFaultLog> listStatusSolve(SysCarFaultLog sysCarFaultLog) {
        LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysCarFaultLog::getStatus,1);
        if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
            wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
        }
        return this.list(wrapper);
    }


}
